package com.cw.gui;

import java.awt.BorderLayout;

import javax.swing.JDesktopPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextField;
import javax.swing.JTree;

import com.cw.Context;

public class MainPanel extends JPanel {

	private MainFrame frame;
	private JSplitPane jsp = new JSplitPane();
	
	private JScrollPane js = new JScrollPane();
	private CpTree cpTree = null;	
	private JTextField statusField = new JTextField();
	private JDesktopPane desktopPane = new JDesktopPane();
	
	public MainPanel(MainFrame frame){
		this.frame = frame;
		cpTree = new CpTree(this); 
		init();
		Context.getInstance().loadAction(this);
	}
	
	private void init() {
		this.setLayout(new BorderLayout());
		js.getViewport().add(cpTree);
		jsp.setDividerLocation(200);
		jsp.setLeftComponent(js);
		jsp.setRightComponent(desktopPane);
		this.add(jsp, BorderLayout.CENTER);
		this.add(statusField, BorderLayout.SOUTH);
	}

	public MainFrame getFrame(){
		return frame;
	}

	public JDesktopPane getDeskTop() {
		return this.desktopPane;
	}
	
	public CpTree getTree(){
		return cpTree;
	}
	
}
